home *** CD-ROM | disk | FTP | other *** search
/ PC Media 22 / PC MEDIA CD22.iso / share / prog / spm220e / teststar.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-10-09  |  20.0 KB  |  618 lines

  1. {
  2. ╔═════════════════════════════════════════════════════════════════════════════╗
  3. ║ NAME      : TESTSTAR.PAS                                                    ║
  4. ║ FUNCTION  : A short utility to demonstrate how to use STARCOMM.EXE...       ║
  5. ║ VERSION   : v2.10                                                           ║
  6. ║ LANGUAGE  : TURBO PASCAL v4.0 and laters.                                   ║
  7. ║ SYNTAX    : (path)> <path_pgm>TESTSTAR [/8]                                 ║
  8. ║           : The "/8" option permits to ask for 8 windows. This is usefull   ║
  9. ║           : to open an access to any serial port above the COM4:...         ║
  10. ║           : This option is ignored if all the ports above COM4: are unknown!║
  11. ║ REMARKS   : ■ Before using any function from the driver that returns a      ║
  12. ║           : boolean, you should check that the driver IS accessible. If not,║
  13. ║           : the returned value would be un-meaningfull and your program     ║
  14. ║           : could then reacts in "stranges" ways !                          ║
  15. ║           : The easyest method consist in checking once for all that the    ║
  16. ║           : driver is present just at the begining of your program execution║
  17. ║           : ■ The ports initializations, the hand-shaking status, and the   ║
  18. ║           : errors working mode are not modified by TESTSTAR.               ║
  19. ║ COPYRIGHT : (C)HETRU Fabrice 1991-1995                                      ║
  20. ╚═════════════════════════════════════════════════════════════════════════════╝
  21. }
  22.  
  23.  
  24.  
  25.                           PROGRAM TestStar;
  26.  
  27.  
  28.  
  29. {$S+}  (* Stack checking............................: YES *)
  30. {$R-}  (* Over-runs check...........................: NO  *)
  31. {$E-}  (* Reals numbers in computations.............: NO  *)
  32. {$B+}  (* Enhanced boolean evaluation...............: YES *)
  33. {$D-}  (* Debug symbols.............................: NO  *)
  34. {$L-}  (* Locals symbols access for debugging.......: NO  *)
  35.  
  36.  
  37. USES
  38.   Crt, Dos, StarIntf;
  39.  
  40.  
  41. CONST
  42.   { Receipt and transmit windows coordinates. }
  43.   x1_com1:BYTE=02;   y1_com1:BYTE=03;   x2_com1:BYTE=19;   y2_com1:BYTE=16;
  44.   x1_com2:BYTE=22;   y1_com2:BYTE=03;   x2_com2:BYTE=39;   y2_com2:BYTE=16;
  45.   x1_com3:BYTE=42;   y1_com3:BYTE=03;   x2_com3:BYTE=59;   y2_com3:BYTE=16;
  46.   x1_com4:BYTE=62;   y1_com4:BYTE=03;   x2_com4:BYTE=79;   y2_com4:BYTE=16;
  47.   x1_com5:BYTE=02;   y1_com5:BYTE=11;   x2_com5:BYTE=19;   y2_com5:BYTE=16;
  48.   x1_com6:BYTE=22;   y1_com6:BYTE=11;   x2_com6:BYTE=39;   y2_com6:BYTE=16;
  49.   x1_com7:BYTE=42;   y1_com7:BYTE=11;   x2_com7:BYTE=59;   y2_com7:BYTE=16;
  50.   x1_com8:BYTE=62;   y1_com8:BYTE=11;   x2_com8:BYTE=79;   y2_com8:BYTE=16;
  51.   x1_send:BYTE=02;   y1_send:BYTE=19;   x2_send:BYTE=79;   y2_send:BYTE=24;
  52.   { Currents writting positions in the differents used windows. }
  53.   XSend:BYTE = 1;    YSend:BYTE = 1;
  54.   Xcom1:BYTE = 1;    Ycom1:BYTE = 1;
  55.   Xcom2:BYTE = 1;    Ycom2:BYTE = 1;
  56.   Xcom3:BYTE = 1;    Ycom3:BYTE = 1;
  57.   Xcom4:BYTE = 1;    Ycom4:BYTE = 1;
  58.   Xcom5:BYTE = 1;    Ycom5:BYTE = 1;
  59.   Xcom6:BYTE = 1;    Ycom6:BYTE = 1;
  60.   Xcom7:BYTE = 1;    Ycom7:BYTE = 1;
  61.   Xcom8:BYTE = 1;    Ycom8:BYTE = 1;
  62.  
  63.  
  64. VAR
  65.   Type_Crt_Mode,
  66.   LastPort,
  67.   SendPort,
  68.   OldSPort,
  69.   error,i       : BYTE                ;
  70.   seg_ecran     : WORD                ;
  71.   VerDrive      : Chn4octets          ;
  72.   PortState     : ARRAY[0..7] OF BYTE ;
  73.   initialise,
  74.   Use8Ports,
  75.   NewEms,
  76.   termine       : BOOLEAN             ;
  77.   Phrase        : STRING[79]          ;
  78.   Eng,Parit,
  79.   StopBit,
  80.   BreakInt      : ARRAY[0..3] OF WORD ;
  81.  
  82.  
  83. PROCEDURE WriteCadre(x1,y1,x2,y2:BYTE;c1,c2,c3,c4,c5,c6:CHAR);
  84.   VAR
  85.     i : BYTE ;
  86.   BEGIN
  87.     Window(1,1,80,25);
  88.     GotoXY(x1,y1); WRITE(c1);
  89.     FOR i := 1 TO x2-x1-1 DO WRITE(c2);
  90.     WRITE(c3);
  91.     FOR i := y1+1 TO y2-1 DO
  92.     BEGIN
  93.       GotoXY(x2,i);
  94.       WRITE(c4)
  95.     END;
  96.     GotoXY(x2,y2); WRITE(c5);
  97.     FOR i := x2-1 DOWNTO x1+1 DO
  98.     BEGIN
  99.       GotoXY(i,y2);
  100.       WRITE(c2)
  101.     END;
  102.     GotoXY(x1,y2); WRITE(c6);
  103.     FOR i := y2-1 DOWNTO y1+1 DO
  104.     BEGIN
  105.       GotoXY(x1,i);
  106.       WRITE(c4)
  107.     END;
  108.   END;
  109.  
  110.  
  111. PROCEDURE Com_Window(Num: BYTE);
  112.   VAR
  113.     x1_com, y1_com, x2_com, y2_com : BYTE ;
  114.   BEGIN
  115.     CASE Num OF
  116.       0: BEGIN
  117.            x1_com:=x1_com1; y1_com:=y1_com1; x2_com:=x2_com1; y2_com:=y2_com1
  118.          END;
  119.       1: BEGIN
  120.            x1_com:=x1_com2; y1_com:=y1_com2; x2_com:=x2_com2; y2_com:=y2_com2
  121.          END;
  122.       2: BEGIN
  123.            x1_com:=x1_com3; y1_com:=y1_com3; x2_com:=x2_com3; y2_com:=y2_com3
  124.          END;
  125.       3: BEGIN
  126.            x1_com:=x1_com4; y1_com:=y1_com4; x2_com:=x2_com4; y2_com:=y2_com4
  127.          END;
  128.       4: BEGIN
  129.            x1_com:=x1_com5; y1_com:=y1_com5; x2_com:=x2_com5; y2_com:=y2_com5
  130.          END;
  131.       5: BEGIN
  132.            x1_com:=x1_com6; y1_com:=y1_com6; x2_com:=x2_com6; y2_com:=y2_com6
  133.          END;
  134.       6: BEGIN
  135.            x1_com:=x1_com7; y1_com:=y1_com7; x2_com:=x2_com7; y2_com:=y2_com7
  136.          END;
  137.       7: BEGIN
  138.            x1_com:=x1_com8; y1_com:=y1_com8; x2_com:=x2_com8; y2_com:=y2_com8
  139.          END;
  140.     END;
  141.     IF PortState[Num] IN [0,8] THEN
  142.     BEGIN
  143.       WriteCadre(x1_com,y1_com,x2_com,y2_com,'┌','─','┐','│','┘','└');
  144.       HighVideo;
  145.       GotoXY(x1_com+1,y1_com); WRITE('COM',Chr(Num+$31),':ems is ');
  146.       CommPort := Num;
  147.       IF Send_SLOW THEN WRITE('slow') ELSE WRITE('fast');
  148.       LowVideo;
  149.     END
  150.     ELSE
  151.     BEGIN
  152.       IF PortState[Num]=5 THEN
  153.       BEGIN
  154.         WriteCadre(x1_com,y1_com,x2_com,y2_com,'█','█','█','█','█','█');
  155.         GotoXY(x1_com+1,y2_com+1); WRITE('PORT NOT KNOWN');
  156.       END
  157.       ELSE
  158.       BEGIN
  159.         WriteCadre(x1_com,y1_com,x2_com,y2_com,'┌','-','┐','|','┘','└');
  160.         GotoXY(x1_com+1,y2_com+1); WRITE('No more buffers!')
  161.       END;
  162.       GotoXY(x1_com+7,y1_com); WRITE('COM',Chr(Num+$31))
  163.     END;
  164.   END;
  165.  
  166.  
  167. PROCEDURE Setup_Screen;
  168.   BEGIN
  169.     ClrScr;
  170.     TextColor(Black); TextBackGround(White);
  171.     GotoXY(1,1); ClrEol;
  172.     GotoXY(18,1); WRITE('TESTSTAR v2.10 for STARCOMM ver ',VerDrive);
  173.     GotoXY(67,1); WRITE('(C)HETRU 1995');
  174.     GotoXY(1,25); ClrEol;
  175.     GotoXY(4,25);
  176.     WRITE('Ctrl-Fi:Transmit COMi▓F2 test▓Ems->F9:slow F10:fast'+
  177.           '▓HOME Empty buffers▓ESC');
  178.     TextColor(LightGray); TextBackGround(Black);
  179.     FOR i := 0 TO LastPort DO Com_Window(i);
  180.     WriteCadre(x1_send,y1_send,x2_send,y2_send,'┌','─','┐','│','┘','└');
  181.     HighVideo;
  182.     GotoXY(x1_send+29,y1_send); WRITE('Transmitting on COM1:');
  183.     CommPort := 0;
  184.     LowVideo
  185.   END;
  186.  
  187.  
  188. PROCEDURE Status_Port;
  189. VAR
  190.   x_com,y_com : BYTE    ;
  191.   Err_sous_it : BOOLEAN ;
  192.   Buff_ovrfl,
  193.   Engorg,
  194.   Parite_chk,
  195.   SBit,BrkIt  : BYTE    ;
  196.   changements,
  197.   Pret,
  198.   Clear_to_send,
  199.   Sonnerie,
  200.   Porteuse    : BOOLEAN ;
  201.   dDSR, dCTS,
  202.   dRI, dDCD   : BYTE    ;
  203.   Num_Voie    : CHAR    ;
  204.   SendOK      : BOOLEAN ;
  205.   NbXoff      : BYTE    ;
  206. BEGIN
  207.   CASE CommPort OF
  208.     0: BEGIN x_com := x1_com1; y_com := y2_com1; END;
  209.     1: BEGIN x_com := x1_com2; y_com := y2_com2; END;
  210.     2: BEGIN x_com := x1_com3; y_com := y2_com3; END;
  211.     3: BEGIN x_com := x1_com4; y_com := y2_com4; END;
  212.     4: BEGIN x_com := x1_com5; y_com := y2_com5; END;
  213.     5: BEGIN x_com := x1_com6; y_com := y2_com6; END;
  214.     6: BEGIN x_com := x1_com7; y_com := y2_com7; END;
  215.     7: BEGIN x_com := x1_com8; y_com := y2_com8; END
  216.   END;
  217.   (* Link and comms. errors reported by the low level comm. *)
  218.   Err_sous_it := Errors_Report(Buff_ovrfl,Engorg,Parite_chk,SBit,BrkIt);
  219.   IF Err_sous_it THEN
  220.   BEGIN
  221.     Window(1,1,80,25);
  222.     IF Engorg>0 THEN
  223.     BEGIN
  224.       GotoXY(x_com+4,y_com+2);
  225.       WRITE('Over-runs');
  226.       Delay(100);
  227.       GotoXY(x_com+4,y_com+2);
  228.       WRITE('         ');
  229.     END;
  230.     IF Parite_chk>0 THEN
  231.     BEGIN
  232.       GotoXY(x_com+6,y_com+2);
  233.       WRITE('Parity');
  234.       Delay(100);
  235.       GotoXY(x_com+6,y_com+2);
  236.       WRITE('      ');
  237.     END;
  238.     IF SBit>0 THEN
  239.     BEGIN
  240.       GotoXY(x_com+4,y_com+2);
  241.       WRITE('Stop-bits');
  242.       Delay(100);
  243.       GotoXY(x_com+4,y_com+2);
  244.       WRITE('         ');
  245.     END;
  246.     IF BrkIt>0 THEN
  247.     BEGIN
  248.       GotoXY(x_com+7,y_com+2);
  249.       WRITE('BREAK');
  250.       Delay(100);
  251.       GotoXY(x_com+7,y_com+2);
  252.       WRITE('     ');
  253.     END
  254.   END;
  255.   (* Up-dating of the modem status indicators. *)
  256.   Num_Voie := Chr(CommPort+$31);
  257.   Etat_du_Modem(Num_Voie, Pret, Clear_to_send, Sonnerie,
  258.                 Porteuse, changements, dDSR, dCTS, dRI, dDCD);
  259.   IF changements OR initialise THEN
  260.   BEGIN
  261.     Window(1,1,80,25);
  262.     GotoXY(x_com+2,y_com+1);
  263.     IF Pret THEN WRITE('DSR')
  264.       ELSE
  265.       BEGIN
  266.         IF dDSR>0 THEN
  267.           BEGIN WRITE('DSR'); GotoXY(x_com+2,y_com+1); Delay(10); END;
  268.         WRITE('dsr')
  269.       END;
  270.     GotoXY(x_com+6,y_com+1);
  271.     IF Clear_to_send THEN WRITE('CTS')
  272.       ELSE
  273.       BEGIN
  274.         IF dCTS>0 THEN
  275.           BEGIN WRITE('CTS'); GotoXY(x_com+6,y_com+1); Delay(10); END;
  276.         WRITE('cts')
  277.       END;
  278.     GotoXY(x_com+10,y_com+1);
  279.     IF Sonnerie THEN WRITE('RI')
  280.       ELSE
  281.       BEGIN
  282.         IF dRI>0 THEN
  283.           BEGIN WRITE('RI'); GotoXY(x_com+10,y_com+1); Delay(10); END;
  284.         WRITE('ri')
  285.       END;
  286.     GotoXY(x_com+13,y_com+1);
  287.     IF Porteuse THEN WRITE('DCD')
  288.       ELSE
  289.       BEGIN
  290.         IF dDCD>0 THEN
  291.           BEGIN WRITE('DCD'); GotoXY(x_com+13,y_com+1); Delay(10); END;
  292.         WRITE('dcd')
  293.       END;
  294.   END;
  295.   (* Informations on the current Xon/Xoff protocol status and working mode. *)
  296.   IF XonoffShaking_Status(SendOK,NbXoff) IN [Ord('L'),Ord('B')] THEN
  297.   BEGIN
  298.     Dec(x_com); Dec(y_com);
  299.     IF SendOK THEN
  300.     BEGIN
  301.       MEM[seg_ecran:2*((80*y_com)+x_com+5)] := Ord('X');
  302.       MEM[seg_ecran:2*((80*y_com)+x_com+6)] := Ord('O');
  303.       MEM[seg_ecran:2*((80*y_com)+x_com+7)] := Ord('N');
  304.       MEM[seg_ecran:2*((80*y_com)+x_com+8)] := Ord('/');
  305.       MEM[seg_ecran:2*((80*y_com)+x_com+9)] := Ord('X');
  306.       MEM[seg_ecran:2*((80*y_com)+x_com+10)] := Ord('o');
  307.       MEM[seg_ecran:2*((80*y_com)+x_com+11)] := Ord('f');
  308.       MEM[seg_ecran:2*((80*y_com)+x_com+12)] := Ord('f');
  309.     END
  310.     ELSE
  311.     BEGIN
  312.       MEM[seg_ecran:2*((80*y_com)+x_com+5)] := Ord('X');
  313.       MEM[seg_ecran:2*((80*y_com)+x_com+6)] := Ord('o');
  314.       MEM[seg_ecran:2*((80*y_com)+x_com+7)] := Ord('n');
  315.       MEM[seg_ecran:2*((80*y_com)+x_com+8)] := Ord('/');
  316.       MEM[seg_ecran:2*((80*y_com)+x_com+9)] := Ord('X');
  317.       MEM[seg_ecran:2*((80*y_com)+x_com+10)] := Ord('O');
  318.       MEM[seg_ecran:2*((80*y_com)+x_com+11)] := Ord('F');
  319.       MEM[seg_ecran:2*((80*y_com)+x_com+12)] := Ord('F')
  320.     END;
  321.   END
  322. END;
  323.  
  324.  
  325. PROCEDURE Input_Port;
  326. VAR
  327.   caract     : CHAR ;
  328.   Nb_a_lire,
  329.   Received   : WORD ;
  330. BEGIN
  331.   IF CheckBufferIn(Nb_a_lire) THEN
  332.   BEGIN
  333.     CASE CommPort OF
  334.       0: BEGIN
  335.            Window(x1_com1+1,y1_com1+1,x2_com1-1,y2_com1-1);
  336.            GotoXY(Xcom1,Ycom1)
  337.          END;
  338.       1: BEGIN
  339.            Window(x1_com2+1,y1_com2+1,x2_com2-1,y2_com2-1);
  340.            GotoXY(Xcom2,Ycom2)
  341.          END;
  342.       2: BEGIN
  343.            Window(x1_com3+1,y1_com3+1,x2_com3-1,y2_com3-1);
  344.            GotoXY(Xcom3,Ycom3)
  345.          END;
  346.       3: BEGIN
  347.            Window(x1_com4+1,y1_com4+1,x2_com4-1,y2_com4-1);
  348.            GotoXY(Xcom4,Ycom4)
  349.          END;
  350.       4: BEGIN
  351.            Window(x1_com5+1,y1_com5+1,x2_com5-1,y2_com5-1);
  352.            GotoXY(Xcom5,Ycom5)
  353.          END;
  354.       5: BEGIN
  355.            Window(x1_com6+1,y1_com6+1,x2_com6-1,y2_com6-1);
  356.            GotoXY(Xcom6,Ycom6)
  357.          END;
  358.       6: BEGIN
  359.            Window(x1_com7+1,y1_com7+1,x2_com7-1,y2_com7-1);
  360.            GotoXY(Xcom7,Ycom7)
  361.          END;
  362.       7: BEGIN
  363.            Window(x1_com8+1,y1_com8+1,x2_com8-1,y2_com8-1);
  364.            GotoXY(Xcom8,Ycom8)
  365.          END;
  366.     END;
  367.     REPEAT
  368.       error := ReadSerie(caract,1,Received);
  369.       Dec(Nb_a_lire);
  370.       WRITE(caract);
  371.     UNTIL (Nb_a_lire=0) OR (error<>0);
  372.     CASE CommPort OF
  373.       0: BEGIN Xcom1 := WhereX; Ycom1 := WhereY END;
  374.       1: BEGIN Xcom2 := WhereX; Ycom2 := WhereY END;
  375.       2: BEGIN Xcom3 := WhereX; Ycom3 := WhereY END;
  376.       3: BEGIN Xcom4 := WhereX; Ycom4 := WhereY END;
  377.       4: BEGIN Xcom5 := WhereX; Ycom5 := WhereY END;
  378.       5: BEGIN Xcom6 := WhereX; Ycom6 := WhereY END;
  379.       6: BEGIN Xcom7 := WhereX; Ycom7 := WhereY END;
  380.       7: BEGIN Xcom8 := WhereX; Ycom8 := WhereY END;
  381.     END;
  382.   END
  383. END;
  384.  
  385.  
  386. PROCEDURE Output_Port;
  387. VAR
  388.   caract : CHAR ;
  389.   Nb_wr  : WORD ;
  390.   (* Procedure to inform on an error. *)
  391. PROCEDURE Message(message: STRING);
  392.   BEGIN
  393.     Window(1,1,80,25);
  394.     GotoXY(78-Length(message),y2_send);
  395.     WRITE(message); Delay(300);
  396.     GotoXY(78-Length(message),y2_send);
  397.     FOR i:=1 TO Length(message) DO WRITE('─')
  398.   END;
  399.   (* End of the error msg procedure. *)
  400. BEGIN
  401.   Window(x1_send+1,y1_send+1,x2_send-1,y2_send-1);
  402.   GotoXY(XSend,YSend);
  403.   IF KeyPressed THEN
  404.   BEGIN
  405.     CommPort := SendPort;
  406.     caract := ReadKey;
  407.     CASE caract OF
  408.       #27: termine := TRUE;
  409.       #0: BEGIN
  410.         IF KeyPressed THEN
  411.         BEGIN
  412.           caract := ReadKey;
  413.           IF LastPort>3 THEN
  414.             CASE caract OF
  415.               #98: BEGIN SendPort := 4; ClrScr END;
  416.               #99: BEGIN SendPort := 5; ClrScr END;
  417.               #100: BEGIN SendPort := 6; ClrScr END;
  418.               #101: BEGIN SendPort := 7; ClrScr END
  419.             END;
  420.           CASE caract OF
  421.             #94: BEGIN SendPort := 0; ClrScr END;
  422.             #95: BEGIN SendPort := 1; ClrScr END;
  423.             #96: BEGIN SendPort := 2; ClrScr END;
  424.             #97: BEGIN SendPort := 3; ClrScr END;
  425.             #60: BEGIN  (* F2 key: Sending the LAZY FOX... test ! *)
  426.                    error := WriteSerie(Phrase[1],Length(Phrase),Nb_wr);
  427.                    IF error=0 THEN WRITE(Phrase)
  428.                      ELSE
  429.                      BEGIN
  430.                        FOR i := 1 TO Nb_wr DO WRITE(Phrase[i]);
  431.                        CASE error OF
  432.                          4: Message('Transmit TIME-OUT');
  433.                          5: Message('Port NOT supported')
  434.                        END;
  435.                      END
  436.                  END;
  437.             #67: IF SLOW_Ems=0 THEN
  438.                  BEGIN
  439.                    Message('SLOW Transm');
  440.                    NewEMS := TRUE
  441.                  END;
  442.             #68: IF FAST_Ems=0 THEN
  443.                  BEGIN
  444.                    Message('FAST Transm');
  445.                    NewEMS := TRUE
  446.                  END;
  447.             #71: BEGIN  (* HOME key:Clear the current window and its buffers *)
  448.                    Flush_buffers;
  449.                    CASE CommPort OF
  450.                      0: BEGIN
  451.                           Window(x1_com1+1,y1_com1+1,x2_com1-1,y2_com1-1);
  452.                           Xcom1 := 1; Ycom1 := 1
  453.                         END;
  454.                      1: BEGIN
  455.                           Window(x1_com2+1,y1_com2+1,x2_com2-1,y2_com2-1);
  456.                           Xcom2 := 1; Ycom2 := 1
  457.                         END;
  458.                      2: BEGIN
  459.                           Window(x1_com3+1,y1_com3+1,x2_com3-1,y2_com3-1);
  460.                           Xcom3 := 1; Ycom3 := 1
  461.                         END;
  462.                      3: BEGIN
  463.                           Window(x1_com4+1,y1_com4+1,x2_com4-1,y2_com4-1);
  464.                           Xcom4 := 1; Ycom4 := 1
  465.                         END;
  466.                      4: BEGIN
  467.                           Window(x1_com5+1,y1_com5+1,x2_com5-1,y2_com5-1);
  468.                           Xcom5 := 1; Ycom5 := 1
  469.                         END;
  470.                      5: BEGIN
  471.                           Window(x1_com6+1,y1_com6+1,x2_com6-1,y2_com6-1);
  472.                           Xcom6 := 1; Ycom6 := 1
  473.                         END;
  474.                      6: BEGIN
  475.                           Window(x1_com7+1,y1_com7+1,x2_com7-1,y2_com7-1);
  476.                           Xcom7 := 1; Ycom7 := 1
  477.                         END;
  478.                      7: BEGIN
  479.                           Window(x1_com8+1,y1_com8+1,x2_com8-1,y2_com8-1);
  480.                           Xcom8 := 1; Ycom8 := 1
  481.                         END;
  482.                    END;
  483.                    ClrScr;
  484.                    Window(x1_send+1,y1_send+1,x2_send-1,y2_send-1); ClrScr
  485.                  END;
  486.             END
  487.           END;
  488.         END;
  489.       ELSE
  490.       BEGIN
  491.         IF caract=#03 THEN error := 0
  492.           ELSE error := WriteSerie(caract,1,Nb_wr);
  493.         CASE error OF
  494.           4: Message('Transmit TIME-OUT');
  495.           5: Message('Port NOT supported');
  496.           ELSE
  497.           BEGIN
  498.             CASE caract OF
  499.               #10: GotoXY(1,WhereY);
  500.               #13: WRITELN;
  501.               #08: WRITE(caract+' '+caract);
  502.               #09: WRITE('       ');
  503.               ELSE WRITE(caract)
  504.             END;
  505.           END
  506.         END;
  507.       END
  508.     END;
  509.     XSend := WhereX; YSend := WhereY;
  510.   END
  511. END;
  512.  
  513.  
  514. BEGIN
  515.   CheckBreak := FALSE; (* No Ctrl-Break accepted from the operator. *)
  516.   termine := FALSE;
  517.   initialise := TRUE;
  518.   Use8Ports := FALSE;
  519.   FOR i := 1 TO ParamCount DO
  520.     IF ParamStr(i)='/8' THEN Use8Ports := TRUE;
  521.   Phrase := #10+#13+'The Quick Brown Fox Jumped Over The Lazy Dog''s'+
  522.             + ' Back 0123456789 Times !';
  523.   Type_Crt_Mode := MEM[$40:$49];
  524.   IF NOT (Type_Crt_Mode IN [2,3,7]) THEN TextMode(C80);
  525.   IF MEM[$40:$49]=7 THEN seg_ecran := $B000
  526.     ELSE seg_ecran := $B800;
  527.   SendPort := 0;
  528.   IF type_driver<>0 THEN
  529.   BEGIN
  530.     Version(VerDrive);
  531.     FOR CommPort := 0 TO 7 DO
  532.     BEGIN
  533.       IF Port_Opened THEN BEGIN END;
  534.       PortState[CommPort] := Open_Port
  535.     END;
  536.     LastPort := 3;
  537.     IF Use8Ports THEN
  538.     BEGIN
  539.       IF NOT (ComExist[0] OR ComExist[1] OR ComExist[2] OR ComExist[3] OR
  540.       ComExist[4] OR ComExist[5] OR ComExist[6] OR ComExist[7]) THEN
  541.       BEGIN
  542.         WRITELN('There is NOT even one serial port to use !...');
  543.         Halt(1)
  544.       END;
  545.       IF ComExist[4] OR ComExist[5] OR ComExist[6] OR ComExist[7] THEN
  546.       BEGIN
  547.         y2_com1 := 8; y2_com2 := 8; y2_com3 := 8; y2_com4 := 8;
  548.         LastPort := 7
  549.       END;
  550.     END
  551.     ELSE
  552.       IF NOT (ComExist[0] OR ComExist[1] OR ComExist[2] OR ComExist[3]) THEN
  553.       BEGIN
  554.         WRITELN('There is NOT even one serial port to use !...');
  555.         Halt(1)
  556.       END;
  557.     Setup_Screen;
  558.     REPEAT
  559.       FOR CommPort := 0 TO LastPort DO
  560.       BEGIN
  561.         IF PortState[CommPort] IN [0,8] THEN
  562.         BEGIN
  563.           (* Receive and send errors, hand-shaking status, and modem *)
  564.           (* signals status.                                         *)
  565.           Status_Port;
  566.           (* Serial comm. inputs and information on any comm. error,if any ! *)
  567.           Input_Port
  568.         END;
  569.         IF CommPort=LastPort THEN initialise := FALSE
  570.       END;
  571.       (* Keyboard management to make transmissions. *)
  572.       OldSPort := SendPort;
  573.       NewEms := FALSE;
  574.       Output_Port;
  575.       IF SendPort<>OldSPort THEN
  576.       BEGIN
  577.         Window(1,1,80,25);
  578.         HighVideo;
  579.         GotoXY(x1_send+48,y1_send);
  580.         WRITE(Chr(SendPort+$31));
  581.         LowVideo
  582.       END;
  583.       IF NewEms THEN
  584.       BEGIN
  585.         Window(1,1,80,25);
  586.         HighVideo;
  587.         CASE CommPort OF
  588.           0: GotoXY(x1_com1+13,y1_com1);
  589.           1: GotoXY(x1_com2+13,y1_com2);
  590.           2: GotoXY(x1_com3+13,y1_com3);
  591.           3: GotoXY(x1_com4+13,y1_com4);
  592.           4: GotoXY(x1_com5+13,y1_com5);
  593.           5: GotoXY(x1_com6+13,y1_com6);
  594.           6: GotoXY(x1_com7+13,y1_com7);
  595.           7: GotoXY(x1_com8+13,y1_com8)
  596.         END;
  597.         IF Send_SLOW THEN WRITE('slow') ELSE WRITE('fast');
  598.         LowVideo
  599.       END;
  600.     UNTIL termine;
  601.     Window(1,1,80,25);
  602.     ClrScr;
  603.     GotoXY(1,2);
  604.     WRITELN('TESTSTAR: Simultaneous communication on all the '
  605.       +'accessibles ports.');
  606.     IF type_driver IN [1,2] THEN
  607.       WRITELN('STARCOMM vs ',VerDrive,' manages the asynchronous ports.');
  608.     FOR CommPort := 0 TO LastPort DO
  609.       IF Close_Port(TRUE)=7 THEN
  610.         WRITELN('Port COM',chr(CommPort+$31),' may NOT be closed !');
  611.   END
  612.   ELSE
  613.   BEGIN
  614.     WRITELN('TESTSTAR: Simultaneous communication on all the serial ports.');
  615.     WRITELN('Error: STARCOMM.EXE is not installed in memory !')
  616.   END;
  617. END.
  618.